from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.select import Select
import time

driver = webdriver.Edge()

# 打开页面
driver.get("http://sahitest.com/demo/selectTest.htm")
driver.implicitly_wait(15)
driver.maximize_window()

# 定位到下拉框
select1 = driver.find_element(By.ID,"s1Id")

# 通过Select控件，实例化一个下拉框
x1 = Select(select1)

# 通过下标的方式去选择
# x1.select_by_index(2)

# 通过value选择
# x1.select_by_value("o3")

#通过手动输入内容选择
x1.select_by_visible_text("o2")


time.sleep(1000)
